<!--
Version 0.1
SEMF - Web Desiging Framework for Sport Event Managment
Copyright (C) 2006, SEMF Developers

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
  <xsl:apply-templates /> 
</xsl:template>

<xsl:template match="component">
	<div>
		<xsl:attribute name="id">
			<xsl:value-of select="@id"/>
		</xsl:attribute>
		<xsl:if test="//property/property[@key='Fix-Count']=0">
			<xsl:if test="//property/property[@key='Single']=0">
				<xsl:attribute name="datarepeaterpivot">
					<xsl:text>1</xsl:text>
				</xsl:attribute>
			</xsl:if>
		</xsl:if>
		
		<xsl:for-each select="property/property">
			<xsl:if test="@key='Fix-Count'">
				<xsl:if test=".=0">
					<input type="radio">
						<xsl:attribute name="id">
							<xsl:text>_radio_</xsl:text><xsl:value-of select="//@id"/>
						</xsl:attribute>
						<xsl:attribute name="name">
							<xsl:text>_radio_</xsl:text><xsl:value-of select="//@id"/>
						</xsl:attribute>
						<xsl:attribute name="databind">
							<xsl:text>_radio_span_</xsl:text><xsl:value-of select="//@id"/>
						</xsl:attribute>
						<xsl:attribute name="databind2">
							<xsl:text>_radio_</xsl:text><xsl:value-of select="//@id"/>
							<xsl:text>_sec</xsl:text>
						</xsl:attribute>
					</input>
						
					<span>
						<xsl:if test=
							"//property[@key='Apearance']/property[@key='Hidden_label']=1">
							<xsl:attribute name="style">
								<xsl:text>visibility: hidden;</xsl:text>
							</xsl:attribute>
						</xsl:if>
						<xsl:attribute name="id">
							<xsl:text>_radio_span_</xsl:text><xsl:value-of select="//@id"/>
						</xsl:attribute>
						<xsl:attribute name="databind">
							<xsl:text>_radio_span_</xsl:text><xsl:value-of select="//@id"/>
						</xsl:attribute>
						
						<xsl:for-each select=
								"//property[@key='DataBinding']/property[@key='List']">
							<xsl:value-of select="."/><xsl:text>[databound]</xsl:text>
						</xsl:for-each>
					</span>
				</xsl:if>
			</xsl:if>
		</xsl:for-each>
			
		<!-- This is just to get a loop -->
		<xsl:for-each select="property[@key='Apearance']/property[contains(@key,'Fix-Value')]">
			<xsl:variable name="index"><xsl:value-of select="string(position())"></xsl:value-of></xsl:variable>
			<xsl:variable name="fix-value"><xsl:value-of select="concat('Fix-Value',$index)"></xsl:value-of></xsl:variable>
			<xsl:variable name="fix-value-value"><xsl:value-of select="//property/property[@key=$fix-value]"/></xsl:variable>
			
			<input type="radio">
				<xsl:attribute name="id">
					<xsl:text>_radio_</xsl:text><xsl:value-of select="//@id"/>
				</xsl:attribute>
				<xsl:attribute name="name">
					<xsl:text>_radio_</xsl:text><xsl:value-of select="//@id"/>
				</xsl:attribute>
				<xsl:attribute name="databind">
					<xsl:text>_radio_span_</xsl:text><xsl:value-of select="//@id"/>
				</xsl:attribute>
				<xsl:attribute name="ignorebind">
					<xsl:text>1</xsl:text>
				</xsl:attribute>
				<xsl:attribute name="value">
					<xsl:value-of select="."></xsl:value-of>
				</xsl:attribute>
				<xsl:attribute name="databind2">
					<xsl:text>_radio_</xsl:text><xsl:value-of select="//@id"/>
					<xsl:text>_sec</xsl:text>
				</xsl:attribute>
			</input>
				
			<span>
				<xsl:attribute name="id">
					<xsl:text>_radio_span_</xsl:text><xsl:value-of select="//@id"/>
				</xsl:attribute>
				<xsl:attribute name="databind">
					<xsl:text>_radio_span_</xsl:text><xsl:value-of select="//@id"/>
				</xsl:attribute>
				<xsl:attribute name="ignorebind">
					<xsl:text>1</xsl:text>
				</xsl:attribute>
				<xsl:if test="//property[@key='Apearance']/property[@key='Hidden_label']=1">
					<xsl:attribute name="style">
						<xsl:text>visibility: hidden;</xsl:text>
					</xsl:attribute>
				</xsl:if>
				<xsl:value-of select="."></xsl:value-of>
			</span>		
		</xsl:for-each>
	</div>
	<xsl:for-each select= "//property/property[@key='Fix-Count']">
		<xsl:if test=".=0">
			<br/>
		</xsl:if>
	</xsl:for-each>
</xsl:template>
</xsl:stylesheet>